package main

import (
	"fmt"
	"net/http"

	"example.com/dcachecenter/center"
)

func IndexHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "hello world")
}

func main() {
	go center.HeartBeat()

	http.HandleFunc("/hello", IndexHandler)
	http.HandleFunc("/RegisterNode", center.OperateNodeList)
	http.HandleFunc("/GetAllNodes", center.GetAllNodes)
	http.HandleFunc("/GetAllNodesHttpAddr", center.GetAllNodesHttpAddr)
	http.HandleFunc("/GetAllNodesRpcAddr", center.GetAllNodesRpcAddr)

	http.ListenAndServe("0.0.0.0:8000", nil)
}
